import Vue from "vue"
import vList from "./components/List.vue"

new Vue({
	el: '#app',
	data: {
		list:{}
	},
	render( h ){
		return h( vList, {
			props:{
				list: this.list
			}
		});
	},
	methods:{
		getData( callback ){
			chrome.runtime.sendMessage({action: "get-data"}, function(data) {
				console.log( data )
			  callback( data );
			});
		},
	},
	mounted(){
		this.getData( ( data ) => {
			if( data && Object.keys(data).length ){
				this.list = Object.assign( {}, this.list , data );
			}
		});
	}
})
